<?php

namespace Respect\Http\Module;

use Respect\Http\Bootstrappable;
use Respect\Environment\EnvironmentableInterface;

class Range implements Bootstrappable
{

    public $unit;
    public $sets = array();

    public static function qualify(EnvironmentableInterface $env)
    {
        return $env('HTTP_RANGE') ? new static($env) : false;
    }

    public function __construct(EnvironmentableInterface $env)
    {
        list ($this->unit, $sets) = explode('=', $env('HTTP_RANGE'));
        $this->sets = explode(',', $sets);
    }

}
